package org.example.http.demo;

import org.example.http.*;

import java.io.IOException;

@WebServlet("session")
public class SessionServlet extends HttpServletImpl {
    @Override
    public void doGet(HttpServletRequest req,
                         HttpServletResponse resp)
            throws ServletException, IOException {
        HttpSession session = req.getSession();
        String sessionId = session.getId();
        resp.setContentType("text/html;charset=utf-8");
        resp.getWriter().write("会话ID: " + sessionId);
    }
}
